﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;


namespace MOMKeLABS.Controls.Popup
{
    public partial class MinimizedWindowContextMenu : UserControl
    {

        public Controls.Window.Window ParentWindow
        {
            get;
            set;
        }

        public MinimizedWindowContextMenu()
        {
            InitializeComponent();
        }

        private void CloseButton_Click(object sender, RoutedEventArgs e)
        {
            if ((App.Current as App).VisualRoot.GetType() != typeof(MainPage))
                return;

            if (this.ParentWindow == null)
                return;


            ((App.Current as App).VisualRoot as MainPage).RemoveWindow(this.ParentWindow);

            ((App.Current as App).VisualRoot as MainPage).CloseAllPopupWindows();
        }

        private void RestoreButton_Click(object sender, RoutedEventArgs e)
        {
            if ((App.Current as App).VisualRoot.GetType() != typeof(MainPage))
            {
                return;
            }

            if (this.ParentWindow == null)
                return;

            if (this.ParentWindow.State == Constants.WindowConstants.WindowState.Minimized)
            {
                this.ParentWindow.State = Constants.WindowConstants.WindowState.Normal;
            }

            ((App.Current as App).VisualRoot as MainPage).CloseAllPopupWindows();
        }

        private void MaximiseButton_Click(object sender, RoutedEventArgs e)
        {
            if ((App.Current as App).VisualRoot.GetType() != typeof(MainPage))
            {
                return;
            }

            if (this.ParentWindow == null)
                return;

            this.ParentWindow.State = Constants.WindowConstants.WindowState.Maximized;

            ((App.Current as App).VisualRoot as MainPage).CloseAllPopupWindows();
        }
    }
}
